package com.yf.tz.vo.down;


import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yf.tz.entity.AccountRecordEntity;
import com.yf.tz.enums.AccountRecordBusEnum;
import com.yf.tz.enums.AccountRecordStatusEnum;
import com.yf.tz.vo.AccountRecordVo;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 账户记录实体
 * 表名 account_record
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Sat Aug 01 15:17:48 CST 2020
 */
@Data
public class AccountRecordDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //转账人
    @ExcelProperty("转账人")
    private Long fromUserId;

    //到账人
    @ExcelProperty("到账人")
    private Long toUserId;

    //类型
    @ExcelProperty("类型")
    private Integer type;

    //ENUM-状态:"WAIT-未完成","DONE-已完成"
    @ExcelIgnore
    private Integer status;
    @ExcelProperty("状态")
    private String statusStr;

    //ENUM-业务:"TRANSFER-调配","CHARGE-充值","BACK-返还","PAY-支付","REWARD-奖励"
    @ExcelIgnore
    private Integer bus;
    @ExcelProperty("业务")
    private String busStr;

    //变动数量
    @ExcelProperty("变动数量")
    private BigDecimal amount;

    //转账人剩余数量
    @ExcelProperty("转账人剩余数量")
    private BigDecimal fromNowAmount;

    //到账人剩余数量
    @ExcelProperty("到账人剩余数量")
    private BigDecimal toNowAmount;

    //变动时间
    @ExcelProperty("变动时间")
    private Date time;

    //变动原因
    @ExcelProperty("变动原因")
    private String info;

    //
    @ExcelProperty("")
    private Integer hide;

    //相关订单编号
    @ExcelProperty("相关订单编号")
    private String orderNo;


    public AccountRecordDown() {

    }

    public AccountRecordDown(AccountRecordVo vo) {
        AccountRecordEntity entity = vo.getEntity();
        this.setId(entity.getId());

        this.setFromUserId(entity.getFromUserId());

        this.setToUserId(entity.getToUserId());

        this.setType(entity.getType());

        this.setStatus(entity.getStatus());
        this.setStatusStr(AccountRecordStatusEnum.indexOf(entity.getStatus()));

        this.setBus(entity.getBus());
        this.setBusStr(AccountRecordBusEnum.indexOf(entity.getBus()));

        this.setAmount(entity.getAmount());

        this.setFromNowAmount(entity.getFromNowAmount());

        this.setToNowAmount(entity.getToNowAmount());

        this.setTime(entity.getTime());

        this.setInfo(entity.getInfo());

        this.setHide(entity.getHide());

        this.setOrderNo(entity.getOrderNo());

    }


}
